class LightsMut extends Mutator;

struct sLight
{
	var Light Light;
	var int DefLightBrightness;
};
var array<sLight> Lights;

replication
{
	reliable if (ROLE == ROLE_Authority)
		SetLight;
}

//--------------------------------------------------------------------------------------------------
//--------------------------------------------------------------------------------------------------
simulated function SetLight(int coeff)
{
	local Light L;
	local vector loc;
	local int i;
	local bool bFound;
	Level.GetLocalPlayerController().ClientMessage("SetLight"@coeff);
	foreach Level.AllActors(class'Light', L)
	{
		L.LightBrightness=0;
		L.Destroy();
		continue;
		Level.GetLocalPlayerController().ClientMessage(L.Name);
		for (i=0; i<Lights.Length; i++)
		{
			if (L==Lights[i].Light)
			{
				bFound=true;
				L.LightBrightness = coeff;
				loc = L.Location;
				loc.Z +=1.f;
				L.SetLocation(loc);
			}
		}
		if (bFound==false)
		{
			Lights.Insert(0,1);
			Lights[0].Light = L;
			Lights[0].DefLightBrightness = L.LightBrightness;
			L.LightBrightness = coeff;
				loc = L.Location;
				loc.Z +=1.f;
				L.SetLocation(loc);
		}
	}
}
//--------------------------------------------------------------------------------------------------
function Mutate(string input, PlayerController PC)
{
	local int i,n;
	local array<string> iSplit;
	n = Split(input," ", iSplit);
	PC.ClientMessage("n"@n);
	PC.ClientMessage("iSplit[0]"@iSplit[0]);
	PC.ClientMessage("iSplit[1]"@iSplit[1]);
	if (n>1)
	{
		if (iSplit[0]~="SetLight")
		{
			SetLight(int(iSplit[1]));
		}
	}
}
//--------------------------------------------------------------------------------------------------
//--------------------------------------------------------------------------------------------------
defaultproperties
{
	RemoteRole = ROLE_SimulatedProxy
	bAlwaysRelevant = true
}